import 'package:demo/extension.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart';
import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart';

import 'models/fcl_share_item.dart';
import 'papes/location/location_page.dart';
import 'papes/map/map_page.dart';
import 'widgets/fls_common_widget.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});
  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  late BMFMapController myMapController;
  late Size screenSize;

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: SizedBox(
        width: double.infinity,
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            InkWell(
              onTap: () {
                // 跳转到 MapPage
                Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (context) => const MapPage(title: '百度地图'),
                  ),
                );
              },
              child: Container(
                margin: const EdgeInsets.only(top: 10),
                padding: const EdgeInsets.all(10),
                color: Colors.blue,
                child: const Text('百度地图'),
              ),
            ),
            InkWell(
              onTap: () {
                // 跳转到 MapPage
                Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (context) => const LocationPage(title: '百度定位'),
                  ),
                );
              },
              child: Container(
                margin: const EdgeInsets.only(top: 10),
                padding: const EdgeInsets.all(10),
                color: Colors.blue,
                child: const Text('百度定位'),
              ),
            )
          ],
        ),
      ),
    );
  }



}

